import {
  AksSkuTier,
  Contract,
  EnumCloudProvider,
  EnumKubernetesKind,
  GKENetwork,
  LoadBalancerType,
} from "@porter-dev/api-contracts";
import aws from "legacy/assets/aws.png";
import azure from "legacy/assets/azure.png";
import infra from "legacy/assets/cluster.svg";
import gcp from "legacy/assets/gcp.png";

import {
  type ClientCloudProvider,
  type ClientMachineType,
  type ClientRegion,
  type PreflightCheck,
  type PreflightCheckResolution,
} from "./types";

export const SUPPORTED_AWS_REGIONS: ClientRegion[] = [
  { name: "us-east-1", displayName: "US East (N. Virginia) us-east-1" },
  { name: "us-east-2", displayName: "US East (Ohio) us-east-2" },
  { name: "us-west-1", displayName: "US West (N. California) us-west-1" },
  { name: "us-west-2", displayName: "US West (Oregon) us-west-2" },
  { name: "af-south-1", displayName: "Africa (Cape Town) af-south-1" },
  { name: "ap-east-1", displayName: "Asia Pacific (Hong Kong) ap-east-1" },
  { name: "ap-south-1", displayName: "Asia Pacific (Mumbai) ap-south-1" },
  {
    name: "ap-northeast-2",
    displayName: "Asia Pacific (Seoul) ap-northeast-2",
  },
  {
    name: "ap-southeast-1",
    displayName: "Asia Pacific (Singapore) ap-southeast-1",
  },
  {
    name: "ap-southeast-2",
    displayName: "Asia Pacific (Sydney) ap-southeast-2",
  },
  {
    name: "ap-northeast-1",
    displayName: "Asia Pacific (Tokyo) ap-northeast-1",
  },
  { name: "ca-central-1", displayName: "Canada (Central) ca-central-1" },
  { name: "eu-central-1", displayName: "Europe (Frankfurt) eu-central-1" },
  { name: "eu-west-1", displayName: "Europe (Ireland) eu-west-1" },
  { name: "eu-west-2", displayName: "Europe (London) eu-west-2" },
  { name: "eu-south-1", displayName: "Europe (Milan) eu-south-1" },
  { name: "eu-west-3", displayName: "Europe (Paris) eu-west-3" },
  { name: "eu-north-1", displayName: "Europe (Stockholm) eu-north-1" },
  { name: "me-south-1", displayName: "Middle East (Bahrain) me-south-1" },
  { name: "sa-east-1", displayName: "South America (São Paulo) sa-east-1" },
];

const SUPPORTED_GCP_REGIONS: ClientRegion[] = [
  { name: "us-east1", displayName: "us-east1 (South Carolina, USA)" },
  { name: "us-east4", displayName: "us-east4 (Virginia, USA)" },
  { name: "us-central1", displayName: "us-central1 (Iowa, USA)" },
  { name: "europe-north1", displayName: "europe-north1 (Hamina, Finland)" },
  { name: "europe-central2", displayName: "europe-central2 (Warsaw, Poland)" },
  { name: "europe-west1", displayName: "europe-west1 (St. Ghislain, Belgium)" },
  { name: "europe-west2", displayName: "europe-west2 (London, England)" },
  { name: "europe-west6", displayName: "europe-west6 (Zurich, Switzerland)" },
  { name: "europe-west9", displayName: "europe-west9 (Paris, France)" },
  { name: "asia-south1", displayName: "asia-south1 (Mumbai, India)" },
  { name: "us-west1", displayName: "us-west1 (Oregon, USA)" },
  { name: "us-west2", displayName: "us-west2 (Los Angeles, USA)" },
  { name: "us-west3", displayName: "us-west3 (Salt Lake City, USA)" },
  { name: "us-west4", displayName: "us-west4 (Las Vegas, USA)" },
];

const SUPPORTED_AZURE_REGIONS: ClientRegion[] = [
  { name: "australiaeast", displayName: "Australia East" },
  { name: "brazilsouth", displayName: "Brazil South" },
  { name: "canadacentral", displayName: "Canada Central" },
  { name: "centralindia", displayName: "Central India" },
  { name: "centralus", displayName: "Central US" },
  { name: "eastasia", displayName: "East Asia" },
  { name: "eastus", displayName: "East US" },
  { name: "eastus2", displayName: "East US 2" },
  { name: "francecentral", displayName: "France Central" },
  { name: "northeurope", displayName: "North Europe" },
  { name: "norwayeast", displayName: "Norway East" },
  { name: "southafricanorth", displayName: "South Africa North" },
  { name: "southcentralus", displayName: "South Central US" },
  { name: "swedencentral", displayName: "Sweden Central" },
  { name: "switzerlandnorth", displayName: "Switzerland North" },
  { name: "uaenorth", displayName: "UAE North" },
  { name: "uksouth", displayName: "UK South" },
  { name: "westeurope", displayName: "West Europe" },
  { name: "westus2", displayName: "West US 2" },
  { name: "westus3", displayName: "West US 3" },
];

// https://aws.amazon.com/ec2/instance-types
const SUPPORTED_AWS_MACHINE_TYPES: ClientMachineType[] = [
  {
    name: "t3.medium",
    displayName: "t3.medium",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 4096,
  },
  {
    name: "t3.large",
    displayName: "t3.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "t3.xlarge",
    displayName: "t3.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "t3.2xlarge",
    displayName: "t3.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "t3a.medium",
    displayName: "t3a.medium",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 4096,
  },
  {
    name: "t3a.large",
    displayName: "t3a.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "t3a.xlarge",
    displayName: "t3a.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "t3a.2xlarge",
    displayName: "t3a.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "t4g.medium",
    displayName: "t4g.medium",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 4096,
  },
  {
    name: "t4g.large",
    displayName: "t4g.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "t4g.xlarge",
    displayName: "t4g.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "t4g.2xlarge",
    displayName: "t4g.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "c6i.large",
    displayName: "c6i.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 4096,
  },
  {
    name: "c6i.xlarge",
    displayName: "c6i.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 8192,
  },
  {
    name: "c6i.2xlarge",
    displayName: "c6i.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 16384,
  },
  {
    name: "c6i.4xlarge",
    displayName: "c6i.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 32768,
  },
  {
    name: "c6i.8xlarge",
    displayName: "c6i.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 65536,
  },
  {
    name: "c6a.large",
    displayName: "c6a.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 4096,
  },
  {
    name: "c6a.2xlarge",
    displayName: "c6a.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 16384,
  },
  {
    name: "c6a.4xlarge",
    displayName: "c6a.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 32768,
  },
  {
    name: "c6a.8xlarge",
    displayName: "c6a.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 65536,
  },
  {
    name: "r6i.large",
    displayName: "r6i.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 16384,
  },
  {
    name: "r6i.xlarge",
    displayName: "r6i.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 32768,
  },
  {
    name: "r6i.2xlarge",
    displayName: "r6i.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 65536,
  },
  {
    name: "r6i.4xlarge",
    displayName: "r6i.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 131072,
  },
  {
    name: "r6i.8xlarge",
    displayName: "r6i.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 262144,
  },
  {
    name: "r6i.12xlarge",
    displayName: "r6i.12xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 48,
    ramMegabytes: 393216,
  },
  {
    name: "r6i.16xlarge",
    displayName: "r6i.16xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 64,
    ramMegabytes: 524288,
  },
  {
    name: "r6i.24xlarge",
    displayName: "r6i.24xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 96,
    ramMegabytes: 786432,
  },
  {
    name: "r6i.32xlarge",
    displayName: "r6i.32xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 128,
    ramMegabytes: 1048576,
  },
  {
    name: "r7a.large",
    displayName: "r7a.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 16384,
  },
  {
    name: "r7a.xlarge",
    displayName: "r7a.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 32768,
  },
  {
    name: "r7a.2xlarge",
    displayName: "r7a.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 65536,
  },
  {
    name: "r7a.4xlarge",
    displayName: "r7a.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 131072,
  },
  {
    name: "r7a.8xlarge",
    displayName: "r7a.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 262144,
  },
  {
    name: "r7a.12xlarge",
    displayName: "r7a.12xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 48,
    ramMegabytes: 393216,
  },
  {
    name: "r7a.16xlarge",
    displayName: "r7a.16xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 64,
    ramMegabytes: 524288,
  },
  {
    name: "r7a.24xlarge",
    displayName: "r7a.24xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 96,
    ramMegabytes: 786432,
  },
  {
    name: "r7a.32xlarge",
    displayName: "r7a.32xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 128,
    ramMegabytes: 1048576,
  },
  {
    name: "r7g.medium",
    displayName: "r7g.medium",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 1,
    ramMegabytes: 8192,
  },
  {
    name: "r7g.large",
    displayName: "r7g.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 16384,
  },
  {
    name: "r7g.xlarge",
    displayName: "r7g.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 32768,
  },
  {
    name: "r7g.2xlarge",
    displayName: "r7g.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 65536,
  },
  {
    name: "r7g.4xlarge",
    displayName: "r7g.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 131072,
  },
  {
    name: "r7g.8xlarge",
    displayName: "r7g.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 262144,
  },
  {
    name: "r7g.12xlarge",
    displayName: "r7g.12xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 48,
    ramMegabytes: 393216,
  },
  {
    name: "r7g.16xlarge",
    displayName: "r7g.16xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 64,
    ramMegabytes: 524288,
  },
  {
    name: "m5n.large",
    displayName: "m5n.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "m5n.xlarge",
    displayName: "m5n.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "m5n.2xlarge",
    displayName: "m5n.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "m6a.large",
    displayName: "m6a.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "m6a.xlarge",
    displayName: "m6a.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "m6a.2xlarge",
    displayName: "m6a.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "m6a.4xlarge",
    displayName: "m6a.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 65536,
  },
  {
    name: "m6a.8xlarge",
    displayName: "m6a.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 131072,
  },
  {
    name: "m6a.12xlarge",
    displayName: "m6a.12xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 48,
    ramMegabytes: 196608,
  },
  {
    name: "m7a.medium",
    displayName: "m7a.medium",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 1,
    ramMegabytes: 4096,
  },
  {
    name: "m7a.large",
    displayName: "m7a.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "m7a.xlarge",
    displayName: "m7a.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "m7a.2xlarge",
    displayName: "m7a.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "m7a.4xlarge",
    displayName: "m7a.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 65536,
  },
  {
    name: "m7a.8xlarge",
    displayName: "m7a.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 131072,
  },
  {
    name: "m7a.12xlarge",
    displayName: "m7a.12xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 48,
    ramMegabytes: 196608,
  },
  {
    name: "m7a.16xlarge",
    displayName: "m7a.16xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 64,
    ramMegabytes: 262144,
  },
  {
    name: "m7a.24xlarge",
    displayName: "m7a.24xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 96,
    ramMegabytes: 393216,
  },
  {
    name: "m7i.large",
    displayName: "m7i.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "m7i.xlarge",
    displayName: "m7i.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "m7i.2xlarge",
    displayName: "m7i.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "m7i.4xlarge",
    displayName: "m7i.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 65536,
  },
  {
    name: "m7i.8xlarge",
    displayName: "m7i.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 131072,
  },
  {
    name: "m7i.12xlarge",
    displayName: "m7i.12xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 48,
    ramMegabytes: 196608,
  },
  {
    name: "c7a.medium",
    displayName: "c7a.medium",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 1,
    ramMegabytes: 2048,
  },
  {
    name: "c7a.large",
    displayName: "c7a.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 4096,
  },
  {
    name: "c7a.xlarge",
    displayName: "c7a.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 8192,
  },
  {
    name: "c7a.2xlarge",
    displayName: "c7a.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 16384,
  },
  {
    name: "c7a.4xlarge",
    displayName: "c7a.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 32768,
  },
  {
    name: "c7a.8xlarge",
    displayName: "c7a.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 65536,
  },
  {
    name: "c7a.12xlarge",
    displayName: "c7a.12xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 48,
    ramMegabytes: 98304,
  },
  {
    name: "c7a.16xlarge",
    displayName: "c7a.16xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 64,
    ramMegabytes: 131072,
  },
  {
    name: "c7a.24xlarge",
    displayName: "c7a.24xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 96,
    ramMegabytes: 196608,
  },
  {
    name: "c7g.medium",
    displayName: "c7g.medium",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 1,
    ramMegabytes: 2048,
  },
  {
    name: "c7g.large",
    displayName: "c7g.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 4096,
  },
  {
    name: "c7g.xlarge",
    displayName: "c7g.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 8192,
  },
  {
    name: "c7g.2xlarge",
    displayName: "c7g.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 16384,
  },
  {
    name: "c7g.4xlarge",
    displayName: "c7g.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 32768,
  },
  {
    name: "c7g.8xlarge",
    displayName: "c7g.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 65536,
  },
  {
    name: "c7g.12xlarge",
    displayName: "c7g.12xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 48,
    ramMegabytes: 98304,
  },
  {
    name: "c7g.16xlarge",
    displayName: "c7g.16xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 64,
    ramMegabytes: 131072,
  },
  {
    name: "c7gn.medium",
    displayName: "c7gn.medium",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 1,
    ramMegabytes: 2048,
  },
  {
    name: "c7gn.large",
    displayName: "c7gn.large",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 4096,
  },
  {
    name: "c7gn.xlarge",
    displayName: "c7gn.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 8192,
  },
  {
    name: "c7gn.2xlarge",
    displayName: "c7gn.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 16384,
  },
  {
    name: "c7gn.4xlarge",
    displayName: "c7gn.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 32768,
  },
  {
    name: "c7gn.8xlarge",
    displayName: "c7gn.8xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 65536,
  },
  {
    name: "c7gn.12xlarge",
    displayName: "c7gn.12xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 48,
    ramMegabytes: 98304,
  },
  {
    name: "c7gn.16xlarge",
    displayName: "c7gn.16xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 64,
    ramMegabytes: 131072,
  },
  {
    name: "g4dn.xlarge",
    displayName: "g4dn.xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "g4dn.2xlarge",
    displayName: "g4dn.2xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "g4dn.4xlarge",
    displayName: "g4dn.4xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 16,
    ramMegabytes: 65536,
  },
  {
    name: "p4d.24xlarge",
    displayName: "p4d.24xlarge",
    supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 96,
    ramMegabytes: 1179648,
  },
];

// https://cloud.google.com/compute/docs/general-purpose-machines
const SUPPORTED_GCP_MACHINE_TYPES: ClientMachineType[] = [
  {
    name: "e2-standard-2",
    displayName: "e2-standard-2",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "e2-standard-4",
    displayName: "e2-standard-4",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "e2-standard-8",
    displayName: "e2-standard-8",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "e2-standard-16",
    displayName: "e2-standard-16",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 65536,
  },
  {
    name: "e2-standard-32",
    displayName: "e2-standard-32",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 131072,
  },
  {
    name: "c3-standard-4",
    displayName: "c3-standard-4",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "c3-standard-8",
    displayName: "c3-standard-8",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "c3-standard-22",
    displayName: "c3-standard-22",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 22,
    ramMegabytes: 90112,
  },
  {
    name: "c3-standard-44",
    displayName: "c3-standard-44",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 44,
    ramMegabytes: 180224,
  },
  {
    name: "c3-highcpu-4",
    displayName: "c3-highcpu-4",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 8192,
  },
  {
    name: "c3-highcpu-8",
    displayName: "c3-highcpu-8",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 16384,
  },
  {
    name: "c3-highcpu-22",
    displayName: "c3-highcpu-22",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 22,
    ramMegabytes: 45056,
  },
  {
    name: "c3-highcpu-44",
    displayName: "c3-highcpu-44",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 44,
    ramMegabytes: 90112,
  },
  {
    name: "c3d-highcpu-4",
    displayName: "c3d-highcpu-4",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 8000,
  },
  {
    name: "c3d-highcpu-8",
    displayName: "c3d-highcpu-8",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 16000,
  },
  {
    name: "c3d-highcpu-16",
    displayName: "c3d-highcpu-16",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 32000,
  },
  {
    name: "c3d-highcpu-60",
    displayName: "c3d-highcpu-60",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 60,
    ramMegabytes: 118000,
  },
  {
    name: "c3d-highcpu-90",
    displayName: "c3d-highcpu-90",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 90,
    ramMegabytes: 177000,
  },
  {
    name: "c3d-highcpu-180",
    displayName: "c3d-highcpu-180",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 180,
    ramMegabytes: 354000,
  },
  {
    name: "c3d-highcpu-360",
    displayName: "c3d-highcpu-360",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 360,
    ramMegabytes: 708000,
  },
  {
    name: "c3d-standard-4",
    displayName: "c3d-standard-4",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16000,
  },
  {
    name: "c3d-standard-8",
    displayName: "c3d-standard-8",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32000,
  },
  {
    name: "c3d-standard-16",
    displayName: "c3d-standard-16",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 64000,
  },
  {
    name: "c3d-standard-30",
    displayName: "c3d-standard-30",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 30,
    ramMegabytes: 120000,
  },
  {
    name: "c3d-standard-60",
    displayName: "c3d-standard-60",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 60,
    ramMegabytes: 240000,
  },
  {
    name: "c3d-standard-90",
    displayName: "c3d-standard-90",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 90,
    ramMegabytes: 360000,
  },
  {
    name: "c3d-standard-180",
    displayName: "c3d-standard-180",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 180,
    ramMegabytes: 720000,
  },
  {
    name: "c3d-standard-360",
    displayName: "c3d-standard-360",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 360,
    ramMegabytes: 1440000,
  },
  {
    name: "c3-highmem-4",
    displayName: "c3-highmem-4",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 32768,
  },
  {
    name: "c3-highmem-8",
    displayName: "c3-highmem-8",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 65536,
  },
  {
    name: "c3-highmem-22",
    displayName: "c3-highmem-22",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 22,
    ramMegabytes: 180224,
  },
  {
    name: "c3-highmem-44",
    displayName: "c3-highmem-44",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 44,
    ramMegabytes: 360448,
  },
  {
    name: "n1-standard-1",
    displayName: "n1-standard-1",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 1,
    ramMegabytes: 3840,
  },
  {
    name: "n1-standard-2",
    displayName: "n1-standard-2",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 2,
    ramMegabytes: 7680,
  },
  {
    name: "n1-standard-4",
    displayName: "n1-standard-4",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 4,
    ramMegabytes: 15360,
  },
  {
    name: "n1-standard-8",
    displayName: "n1-standard-8",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 8,
    ramMegabytes: 30720,
  },
  {
    name: "n1-standard-16",
    displayName: "n1-standard-16",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 16,
    ramMegabytes: 61440,
  },
  {
    name: "n1-standard-32",
    displayName: "n1-standard-32",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: false,
    cpuCores: 32,
    ramMegabytes: 122880,
  },
  {
    name: "n1-highmem-2",
    displayName: "n1-highmem-2",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 2,
    ramMegabytes: 13312,
  },
  {
    name: "n1-highmem-4",
    displayName: "n1-highmem-4",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 4,
    ramMegabytes: 26624,
  },
  {
    name: "n1-highmem-8",
    displayName: "n1-highmem-8",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 8,
    ramMegabytes: 53248,
  },
  {
    name: "n1-highmem-16",
    displayName: "n1-highmem-16",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 16,
    ramMegabytes: 106496,
  },
  {
    name: "n1-highmem-32",
    displayName: "n1-highmem-32",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 32,
    ramMegabytes: 212992,
  },
  {
    name: "n1-highcpu-8",
    displayName: "n1-highcpu-8",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 8,
    ramMegabytes: 7372,
  },
  {
    name: "n1-highcpu-16",
    displayName: "n1-highcpu-16",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 16,
    ramMegabytes: 14745,
  },
  {
    name: "n1-highcpu-32",
    displayName: "n1-highcpu-32",
    supportedRegions: SUPPORTED_GCP_REGIONS.map((r) => r.name),
    isGPU: true,
    cpuCores: 32,
    ramMegabytes: 29491,
  },
];

const SUPPORTED_AZURE_MACHINE_TYPES: ClientMachineType[] = [
  {
    name: "Standard_B2als_v2",
    displayName: "Standard_B2als_v2",
    supportedRegions: [
      "australiaeast",
      "brazilsouth",
      "canadacentral",
      "centralindia",
      "centralus",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "southcentralus",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
      "westeurope",
      "westus2",
      "westus3",
    ],
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 4096,
  },
  {
    name: "Standard_B2as_v2",
    displayName: "Standard_B2as_v2",
    supportedRegions: [
      "australiaeast",
      "brazilsouth",
      "canadacentral",
      "centralindia",
      "centralus",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "southcentralus",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
      "westeurope",
      "westus2",
      "westus3",
    ],
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "Standard_A2_v2",
    displayName: "Standard_A2_v2",
    supportedRegions: [
      "australiaeast",
      "canadacentral",
      "centralindia",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
    ],
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 4096,
  },
  {
    name: "Standard_A4_v2",
    displayName: "Standard_A4_v2",
    supportedRegions: [
      "australiaeast",
      "canadacentral",
      "centralindia",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
    ],
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 8192,
  },
  {
    name: "Standard_DS1_v2",
    displayName: "Standard_DS1_v2",
    supportedRegions: [
      "australiaeast",
      "canadacentral",
      "centralindia",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
    ],
    isGPU: false,
    cpuCores: 1,
    ramMegabytes: 2584,
  },
  {
    name: "Standard_DS2_v2",
    displayName: "Standard_DS2_v2",
    supportedRegions: [
      "australiaeast",
      "canadacentral",
      "centralindia",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
      "swedencentral",
      "switzerlandnorth",
      "westus3",
    ],
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 7168,
  },
  {
    name: "Standard_D2ads_v5",
    displayName: "Standard_D2ads_v5",
    supportedRegions: [
      "australiaeast",
      "canadacentral",
      "centralindia",
      "eastasia",
      "eastus",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "swedencentral",
      "uaenorth",
      "uksouth",
      "westus3",
    ],
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "Standard_DC1s_v2",
    displayName: "Standard_DC1s_v2",
    supportedRegions: ["eastus", "westeurope"],
    isGPU: false,
    cpuCores: 1,
    ramMegabytes: 4096,
  },
  {
    name: "Standard_DC2s_v2",
    displayName: "Standard_DC2s_v2",
    supportedRegions: ["eastus", "westeurope"],
    isGPU: false,
    cpuCores: 2,
    ramMegabytes: 8192,
  },
  {
    name: "Standard_DC4s_v2",
    displayName: "Standard_DC4s_v2",
    supportedRegions: ["eastus", "westeurope"],
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 16384,
  },
  {
    name: "Standard_DC8_v2",
    displayName: "Standard_DC8_v2",
    supportedRegions: ["eastus", "westeurope"],
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "Standard_B4als_v2",
    displayName: "Standard_B4als_v2",
    supportedRegions: [
      "australiaeast",
      "brazilsouth",
      "canadacentral",
      "centralindia",
      "centralus",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "southcentralus",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
      "westeurope",
      "westus2",
      "westus3",
    ],
    isGPU: false,
    cpuCores: 4,
    ramMegabytes: 8192,
  },
  {
    name: "Standard_B8als_v2",
    displayName: "Standard_B8als_v2",
    supportedRegions: [
      "australiaeast",
      "brazilsouth",
      "canadacentral",
      "centralindia",
      "centralus",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "southcentralus",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
      "westeurope",
      "westus2",
      "westus3",
    ],
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 16384,
  },
  {
    name: "Standard_B16als_v2",
    displayName: "Standard_B16als_v2",
    supportedRegions: [
      "australiaeast",
      "brazilsouth",
      "canadacentral",
      "centralindia",
      "centralus",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "southcentralus",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
      "westeurope",
      "westus2",
      "westus3",
    ],
    isGPU: false,
    cpuCores: 16,
    ramMegabytes: 32768,
  },
  {
    name: "Standard_NC4as_T4_v3",
    displayName: "Standard_NC4as_T4_v3",
    supportedRegions: [
      "australiaeast",
      "centralindia",
      "eastus",
      "eastus2",
      "northeurope",
      "southcentralus",
      "uksouth",
      "westeurope",
      "westus2",
    ],
    isGPU: true,
    cpuCores: 4,
    ramMegabytes: 28672,
  },
  {
    name: "Standard_NC8as_T4_v3",
    displayName: "Standard_NC8as_T4_v3",
    supportedRegions: [
      "australiaeast",
      "centralindia",
      "eastus",
      "eastus2",
      "northeurope",
      "southcentralus",
      "uksouth",
      "westeurope",
      "westus2",
    ],
    isGPU: true,
    cpuCores: 8,
    ramMegabytes: 57344,
  },
  {
    name: "Standard_NC16as_T4_v3",
    displayName: "Standard_NC16as_T4_v3",
    supportedRegions: [
      "australiaeast",
      "centralindia",
      "eastus",
      "eastus2",
      "northeurope",
      "southcentralus",
      "uksouth",
      "westeurope",
      "westus2",
    ],
    isGPU: true,
    cpuCores: 16,
    ramMegabytes: 112640,
  },
  {
    name: "Standard_NC64as_T4_v3",
    displayName: "Standard_NC64as_T4_v3",
    supportedRegions: [
      "australiaeast",
      "centralindia",
      "eastus",
      "eastus2",
      "northeurope",
      "southcentralus",
      "uksouth",
      "westeurope",
      "westus2",
    ],
    isGPU: true,
    cpuCores: 64,
    ramMegabytes: 450560,
  },
  {
    name: "Standard_D8s_v3",
    displayName: "Standard_D8s_v3",
    supportedRegions: [
      "australiaeast",
      "canadacentral",
      "centralindia",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
    ],
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
  {
    name: "Standard_D8s_v5",
    displayName: "Standard_D8s_v5",
    supportedRegions: [
      "australiaeast",
      "canadacentral",
      "centralindia",
      "eastasia",
      "eastus",
      "eastus2",
      "francecentral",
      "northeurope",
      "norwayeast",
      "southafricanorth",
      "swedencentral",
      "switzerlandnorth",
      "uaenorth",
      "uksouth",
    ],
    isGPU: false,
    cpuCores: 8,
    ramMegabytes: 32768,
  },
];
const SUPPORTED_AZURE_SKU_TIERS = [
  {
    name: "FREE",
    displayName: "Free",
  },
  {
    name: "STANDARD",
    displayName: "Standard (for production workloads, +$73/month)",
  },
];

const AWS_EIP_QUOTA_RESOLUTION: PreflightCheckResolution = {
  title: "Requesting more EIP Addresses",
  subtitle:
    "You will need to either request more EIP addresses or delete existing ones in order to provision in the region specified. You can request more addresses by following these steps:",
  steps: [
    {
      text: "Log in to your AWS Account",
      externalLink:
        "https://console.aws.amazon.com/billing/home?region=us-east-1#/account",
    },
    {
      text: "Navigate to the Amazon Elastic Compute Cloud (Amazon EC2) Service Quotas portal",
      externalLink:
        "https://us-east-1.console.aws.amazon.com/servicequotas/home/services/ec2/quotas",
    },
    {
      text: 'Search for "EC2-VPC Elastic IPs" in the search box and click on the search result.',
    },
    {
      text: 'Click on "Request quota increase". In order to provision with Porter, you will need to request at least 3 addresses above your current quota limit.',
    },
    {
      text: "Once that request is approved, return to Porter and retry the provision.",
    },
  ],
};
const AWS_NAT_GATEWAY_QUOTA_RESOLUTION: PreflightCheckResolution = {
  title: "Requesting more NAT Gateways",
  subtitle:
    "You will need to either request more NAT Gateways or delete existing ones in order to provision in the region specified. You can request more NAT Gateways by following these steps:",
  steps: [
    {
      text: "Log in to your AWS Account",
      externalLink:
        "https://console.aws.amazon.com/billing/home?region=us-east-1#/account",
    },
    {
      text: "Navigate to the Amazon Virtual Private Cloud (Amazon VPC) Service Quotas portal",
      externalLink:
        "https://us-east-1.console.aws.amazon.com/servicequotas/home/services/vpc/quotas",
    },
    {
      text: 'Search for "NAT gateways per Availability Zone" in the search box and click on the search result.',
    },
    {
      text: 'Click on "Request quota increase". In order to provision with Porter, you will need to request at least 3 NAT Gateways above your current quota limit.',
    },
    {
      text: "Once that request is approved, return to Porter and retry the provision.",
    },
  ],
};
const AWS_VPC_QUOTA_RESOLUTION: PreflightCheckResolution = {
  title: "Requesting more VPCs",
  subtitle:
    "You will need to either request more VPCs or delete existing ones in order to provision in the region specified. You can request more VPCs by following these steps:",
  steps: [
    {
      text: "Log in to your AWS Account",
      externalLink:
        "https://console.aws.amazon.com/billing/home?region=us-east-1#/account",
    },
    {
      text: "Navigate to the Amazon Virtual Private Cloud (Amazon VPC) Service Quotas portal",
      externalLink:
        "https://us-east-1.console.aws.amazon.com/servicequotas/home/services/vpc/quotas",
    },
    {
      text: 'Search for "VPCs per Region" in the search box and click on the search result.',
    },
    {
      text: 'Click on "Request quota increase". In order to provision with Porter, you will need to request at least 1 VPC above your current quota limit.',
    },
    {
      text: "Once that request is approved, return to Porter and retry the provision.",
    },
  ],
};
const AWS_VCPUS_QUOTA_RESOLUTION: PreflightCheckResolution = {
  title: "Requesting more vCPUs",
  subtitle:
    "You will need to either request more vCPUs or delete existing instances in order to provision in the region specified. You can request more vCPUs by following these steps:",
  steps: [
    {
      text: "Note the quota name flagged in the provision check error as well as the additional quota value required.",
    },
    {
      text: "Log in to your AWS Account",
      externalLink:
        "https://console.aws.amazon.com/billing/home?region=us-east-1#/account",
    },
    {
      text: "Navigate to the Amazon Elastic Compute Cloud (Amazon EC2) Service Quotas portal",
      externalLink:
        "https://us-east-1.console.aws.amazon.com/servicequotas/home/services/ec2/quotas",
    },
    {
      text: "Input the reported quota name from the provision check error into the search box and click on the search result.",
    },
    {
      text: 'Click on "Request quota increase". In order to provision with Porter, the new quota value must be at least the number reported from the provision check error.',
    },
    {
      text: "Once that request is approved, return to Porter and retry the provision.",
    },
  ],
};
const UNAVAILABLE_AVAILABILITY_ZONES: PreflightCheckResolution = {
  title: "Addressing unavailable availability zones",
  subtitle:
    "You will need to select another region, as your AWS account does not support enough Availability Zones in the region specified.",
  steps: [
    {
      text: "Select another region from the region dropdown and retry the provision.",
    },
  ],
};
const OVERLAPPING_CIDR_RESOLUTION: PreflightCheckResolution = {
  title: "Preventing Overlapping CIDR Blocks",
  subtitle:
    "You will need to select an unused CIDR Block in order to provision in the region specified.",
  steps: [
    {
      text: "Change the CIDR blocks on this page to be unique and not overlap with any other CIDR blocks in your account.",
    },
    {
      text: "The VPC CIDR block should be a /16 in the 10.0.0.0/8 range",
    },
    {
      text: "The Service CIDR block should be a /16 in the 172.16.0.0/12 range in accordanc with RFC 1918",
      externalLink: "https://datatracker.ietf.org/doc/html/rfc1918",
    },
    {
      text: "Once you have selected unique CIDR blocks, return to Porter and retry the provision. If you have any issues or questions, please reach out to Porter support",
    },
  ],
};
const AZURE_AUTHZ_RESOLUTION: PreflightCheckResolution = {
  title: "Granting your service principal authorization to your subscription",
  subtitle:
    "You will need to authorize your service principal to read and write to your subscription. To properly configure the service principal, following the creation steps in our docs:",
  steps: [
    {
      text: "Log in to your Azure Portal:",
      externalLink: "https://portal.azure.com",
    },
    {
      text: "Click on the Azure Cloud Shell icon to the right of the global search bar, and select Bash as your shell",
    },
    {
      text: "Follow the directions in our docs to create the Azure role required for provisioning with Porter and attach it to a service principal:",
      externalLink:
        "https://docs.porter.run/provision/provisioning-on-azure#creating-the-service-principal",
    },
    {
      text: "Note the outputted credentials, return to the Azure credential input screen in Porter, and re-enter the credentials to provision",
    },
  ],
};
const AZURE_RESOURCE_PROVIDER_RESOLUTION: PreflightCheckResolution = {
  title: "Enable required resource providers in your subscription",
  subtitle:
    "You will need to enable certain resource providers in your Azure subscription in order for Porter to provision your infrastructure:",
  steps: [
    {
      text: "Take note of any particular resource providers flagged as missing in the provisioning error message.",
    },
    {
      text: "Log in to your Azure Portal:",
      externalLink: "https://portal.azure.com",
    },
    {
      text: "Follow the directions in our docs to enable all required resource providers in your subscription:",
      externalLink:
        "https://docs.porter.run/provision/provisioning-on-azure#prerequisites",
    },
    {
      text: "Changes may take a few minutes to take effect. Once you have enabled the resource providers, return to Porter and retry the provision.",
    },
  ],
};
const AZURE_VCPUS_QUOTA_RESOLUTION: PreflightCheckResolution = {
  title: "Requesting more vCPUs",
  subtitle:
    "You will need to either request more vCPUs or delete existing instances in order to provision in the location specified. You can request more vCPUs by following these steps:",
  steps: [
    {
      text: "Note which resource families were flagged in the provisioning error message. These may include your requested machine types, as well as those required by Porter.",
    },
    {
      text: "Log in to your Azure Portal:",
      externalLink: "https://portal.azure.com",
    },
    {
      text: "Follow the directions in our docs to request quota increases:",
      externalLink:
        "https://docs.porter.run/provision/provisioning-on-azure#compute-quotas",
    },
    {
      text: "Requests may take a few hours to be fulfilled. Once you have confirmed that the quota increases have been granted, return to Porter and retry the provision.",
    },
  ],
};

const SUPPORTED_AWS_PREFLIGHT_CHECKS: PreflightCheck[] = [
  {
    name: "eip",
    displayName: "Elastic IP availability",
    resolution: AWS_EIP_QUOTA_RESOLUTION,
  },
  {
    name: "natGateway",
    displayName: "NAT Gateway availability",
    resolution: AWS_NAT_GATEWAY_QUOTA_RESOLUTION,
  },
  {
    name: "vpc",
    displayName: "VPC availability",
    resolution: AWS_VPC_QUOTA_RESOLUTION,
  },
  {
    name: "vcpu",
    displayName: "vCPU availability",
    resolution: AWS_VCPUS_QUOTA_RESOLUTION,
  },
  {
    name: "cidrAvailability",
    displayName: "CIDR availability",
  },
  {
    name: "enforceCidrUniqueness",
    displayName: "Overlapping CIDR blocks",
    resolution: OVERLAPPING_CIDR_RESOLUTION,
  },
  {
    name: "availabilityZone",
    displayName: "Unavailable Availability Zones in region",
    resolution: UNAVAILABLE_AVAILABILITY_ZONES,
  },
];

const SUPPORTED_AZURE_PREFLIGHT_CHECKS: PreflightCheck[] = [
  {
    name: "authz",
    displayName: "Subscription authorization",
    resolution: AZURE_AUTHZ_RESOLUTION,
  },
  {
    name: "apiEnabled",
    displayName: "Enable resource providers",
    resolution: AZURE_RESOURCE_PROVIDER_RESOLUTION,
  },
  {
    name: "vcpu",
    displayName: "vCPU availability",
    resolution: AZURE_VCPUS_QUOTA_RESOLUTION,
  },
  {
    name: "enforceCidrUniqueness",
    displayName: "Overlapping CIDR blocks",
    resolution: OVERLAPPING_CIDR_RESOLUTION,
  },
];

const SUPPORTED_GCP_PREFLIGHT_CHECKS: PreflightCheck[] = [
  {
    name: "apiEnabled",
    displayName: "APIs enabled on service account",
  },
  {
    name: "cidrAvailability",
    displayName: "CIDR availability",
  },
  {
    name: "iamPermissions",
    displayName: "IAM permissions",
  },
  {
    name: "enforceCidrUniqueness",
    displayName: "Overlapping CIDR blocks",
    resolution: OVERLAPPING_CIDR_RESOLUTION,
  },
];

const DEFAULT_EKS_CONTRACT = new Contract({
  cluster: {
    kind: EnumKubernetesKind.EKS,
    cloudProvider: EnumCloudProvider.AWS,
    kindValues: {
      case: "eksKind",
      value: {
        clusterVersion: "v1.27.0",
        loadBalancer: {
          loadBalancerType: LoadBalancerType.NLB,
        },
        network: {
          serviceCidr: "172.20.0.0/16",
          vpcCidr: "10.78.0.0/16",
        },
      },
    },
  },
});

const DEFAULT_AKS_CONTRACT = new Contract({
  cluster: {
    kind: EnumKubernetesKind.AKS,
    cloudProvider: EnumCloudProvider.AZURE,
    kindValues: {
      case: "aksKind",
      value: {
        clusterVersion: "v1.27",
        cidrRange: "10.78.0.0/16",
        skuTier: AksSkuTier.FREE,
      },
    },
  },
});

const DEFAULT_GKE_CONTRACT = new Contract({
  cluster: {
    kind: EnumKubernetesKind.GKE,
    cloudProvider: EnumCloudProvider.GCP,
    kindValues: {
      case: "gkeKind",
      value: {
        clusterVersion: "v1.27.0",
        network: new GKENetwork({
          cidrRange: "10.78.0.0/16",
          controlPlaneCidr: "10.77.0.0/28",
          podCidr: "10.76.0.0/16",
          serviceCidr: "10.75.0.0/16",
        }),
      },
    },
  },
});

export const CloudProviderAWS: ClientCloudProvider = {
  name: "AWS",
  displayName: "Amazon Web Services",
  icon: aws,
  regions: SUPPORTED_AWS_REGIONS,
  machineTypes: SUPPORTED_AWS_MACHINE_TYPES,
  baseCost: 224.58,
  newClusterDefaultContract: DEFAULT_EKS_CONTRACT,
  preflightChecks: SUPPORTED_AWS_PREFLIGHT_CHECKS,
  config: {
    kind: "AWS",
  },
};
export const CloudProviderGCP: ClientCloudProvider = {
  name: "GCP",
  displayName: "Google Cloud Platform",
  icon: gcp,
  regions: SUPPORTED_GCP_REGIONS,
  machineTypes: SUPPORTED_GCP_MACHINE_TYPES,
  baseCost: 253.0,
  newClusterDefaultContract: DEFAULT_GKE_CONTRACT,
  preflightChecks: SUPPORTED_GCP_PREFLIGHT_CHECKS,
  config: {
    kind: "GCP",
  },
};
export const CloudProviderAzure: ClientCloudProvider & {
  config: { kind: "Azure" };
} = {
  name: "Azure",
  displayName: "Microsoft Azure",
  icon: azure,
  regions: SUPPORTED_AZURE_REGIONS,
  machineTypes: SUPPORTED_AZURE_MACHINE_TYPES,
  baseCost: 164.69,
  newClusterDefaultContract: DEFAULT_AKS_CONTRACT,
  preflightChecks: SUPPORTED_AZURE_PREFLIGHT_CHECKS,
  config: {
    kind: "Azure",
    skuTiers: SUPPORTED_AZURE_SKU_TIERS,
  },
};
export const CloudProviderLocal: ClientCloudProvider = {
  name: "Local",
  displayName: "Local",
  icon: infra,
  regions: [],
  machineTypes: [],
  baseCost: 0,
  newClusterDefaultContract: new Contract({}),
  preflightChecks: [],
  config: {
    kind: "Local",
  },
};
export const CloudProviderHosted: ClientCloudProvider = {
  name: "Hosted",
  displayName: "Hosted",
  icon: infra,
  regions: [],
  machineTypes: [],
  baseCost: 0,
  newClusterDefaultContract: new Contract({}),
  preflightChecks: [],
  config: {
    kind: "Hosted",
  },
};
export const CloudProviderUnknown: ClientCloudProvider = {
  name: "UNKNOWN",
  displayName: "Unknown",
  icon: infra,
  regions: [],
  machineTypes: [],
  baseCost: 0,
  newClusterDefaultContract: new Contract({}),
  preflightChecks: [],
  config: {
    kind: "UNKNOWN",
  },
};
export const SUPPORTED_CLOUD_PROVIDERS = [
  CloudProviderAWS,
  CloudProviderGCP,
  CloudProviderAzure,
  CloudProviderLocal,
  CloudProviderHosted,
  CloudProviderUnknown,
];
